package com.yzt.loginmodule.regist;

import android.content.Intent;
import android.widget.TextView;

import com.yzt.zhuju.base.BaseActivity;

import com.yzt.zhuju.widget.tuiview.TUILinearLayout;
import com.yzt.loginmodule.R;

/**
 * author : bob
 * date   : 2022/12/2
 * desc   : 注册选择性别
 */
public class RegisterChooseGenderActivity extends BaseActivity {

    private int gender = 1;

    private TUILinearLayout tvMale;

    private TUILinearLayout tvFemale;

    private TextView tvNext;

    private String nickname;

    private String avatar;

    @Override
    public int getLayoutId() {
        return R.layout.activity_choose_gender;
    }

    @Override
    public void installViews() {

        nickname = getIntent().getStringExtra("extra_nickname");

        avatar = getIntent().getStringExtra("extra_header");

        tvMale = findViewById(R.id.tv_male);

        tvFemale = findViewById(R.id.tv_female);

        tvNext = findViewById(R.id.tv_next);

        tvMale.setSelected(true);
        tvFemale.setSelected(false);
        tvNext.setSelected(true);

        // 返回
        findViewById(R.id.iv_back).setOnClickListener(v -> finish());

        // 男
        tvMale.setOnClickListener(v -> {
            tvMale.setSelected(true);
            tvFemale.setSelected(false);
            gender = 0;
        });

        // 女
        tvFemale.setOnClickListener(v -> {
            tvMale.setSelected(false);
            tvFemale.setSelected(true);
            gender = 1;
        });

        // 下一步
        tvNext.setOnClickListener(v -> {
            Intent intent = new Intent(this, RegisterChooseBirthdayActivity.class);
            intent.putExtra("extra_header", avatar);
            intent.putExtra("extra_nickname", nickname);
            intent.putExtra("extra_gender", gender);
            startActivity(intent);
        });
    }
}